package com.company.nuwa.common.enumration;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * <p>C端作用域</p >
 *
 * @author Mitchell
 * @version 1.0
 * @date 2020/07/23 16:18
 */
@AllArgsConstructor
public enum DomainScope {

    /**
     * APP
     */
    APP("APP"),

    /**
     * OBS
     */
    OBS("OBS"),

    /**
     * WEB
     */
    WEB("WEB"),
    ;

    @Getter
    private String code;

    /**
     * 根据平台获取C端作用域
     *
     * @param platform
     * @return
     */
    public static DomainScope getDomainScope(Platform platform) {
        if (Platform.ANDROID == platform
                || Platform.IOS == platform
                || Platform.H5 == platform
        ) {
            return APP;
        } else if (Platform.WEB == platform) {
            return WEB;
        } else {
            return OBS;
        }
    }

}
